cmake_minimum_required(VERSION 3.5)

project(tensorrt_cpp)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(CUDA REQUIRED)
if (CUDA_FOUND)
    message(STATUS "CUDA FOUND")
    include_directories(${CUDA_INCLUDE_DIRS})
else()
    message(FALAT_ERROR "CUDA Not Found")
endif()

include_directories(./src)

include_directories(/opt/spdlog/include)
link_directories(/opt/spdlog/lib)

# 手动指定TensorRT路径
if (TENSORRT_DIR)
    include_directories(${TENSORRT_DIR}/include)
    link_directories(${TENSORRT_DIR}/lib)
endif()

file(GLOB_RECURSE PROJECT_SOURCES
    ./*.cpp
    ./*.h)


set(LIBRARIES 
    ${CUDA_LIBRARIES}
    nvinfer nvonnxparser cuda
    spdlog)

add_library(${PROJECT_NAME} SHARED ${PROJECT_SOURCES})
